﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QLTV.Forms.KhaiBao
{
    public partial class frmLichHen : BaseForm
    {
        public frmLichHen()
        {
            InitializeComponent();
        }

        public frmLichHen(string _code, string _rank, string _name)
        {
            InitializeComponent();
            CrewCode = _code;
            rank = _rank;
            name = _name;

        }
        public string CrewCode { get; set; }
        public string rank { get; set; }
        public string name { get; set; }
 
        private void frmLichHen_Load(object sender, EventArgs e)
        {
            tblLichHenBindingSource.AddNew();
            mã_thuyền_viênTextEdit.EditValue = CrewCode;
            txtRank.EditValue = rank;
            txtThuyenVien.EditValue=name;
            người_lập_kế_hoạchTextEdit.EditValue = Program.EmployeeName;
        }
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //dxValidationProvider1.Validate();
            //if (dxValidationProvider1.GetInvalidControls().Count==0)
            //{
                tblLichHenBindingSource.EndEdit();
                tblLichHenTableAdapter.Update(dsTongQuan.tblLichHen);
                alertControl1.Show(this, rm.GetString("sMessageCaption", myCultureInfo), rm.GetString("sMessageSuccess", myCultureInfo));
                this.Close();
            //}
        }

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }
    }
}